import request from '@/utils/request'
import { GET_USER_INFO } from '@/store/actionTypes'

export const getUserInfo = (payload) => {
  return async (dispatch) => {
    const res = await request('/user/profile')
    // dispatch 调用时底层会通知 reducers 根据 type 修改 state 
    dispatch({
      type: GET_USER_INFO,
      payload: res.data
    })
  }
}